<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>后台登陆</title> 
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
	<link rel="stylesheet" href="__PUBLIC__/css/login.css">
	<link rel="shortcut icon" href="/favicon.ico" />
    <script>    
    function detectBrowser()
    {
	    var browser = navigator.appName
	    if(navigator.userAgent.indexOf("MSIE")>0){ 
		    var b_version = navigator.appVersion
			var version = b_version.split(";");
			var trim_Version = version[1].replace(/[ ]/g,"");			
			alert(trim_Version);
		    if ((browser=="Netscape"||browser=="Microsoft Internet Explorer"))
		    {
		    	if(trim_Version == 'MSIE8.0' || trim_Version == 'MSIE7.0' || trim_Version == 'MSIE6.0'){
		    		alert('请使用IE9.0版本以上进行访问');
		    		return;
		    	}
		    }
	    }
   }
    detectBrowser();
   </script>
  </head>
<body>
	<div class="bgbox"></div>
	<div class="container">
		<div class="leftbox">
			<img src="__PUBLIC__/images/welcome.png">
<!-- 			<h3>广州众创织梦商城</h3> -->
			<div class="copyright">
				2014-{:date('Y')} &copy <a class="a1" href="http://www.vyxjj.com" target="_blank">V3.5.0</a> <a class="a2" href="http://www.vyxjj.com" target="_blank">ViaWeb出品</a>
			</div>
		</div>
		<div class="rightbox">
			<div class="inputbox">
				<img src="__PUBLIC__/images/hy.png">
				<input type="text" name="username" id="username" placeholder="请输入账号">
			</div>
			<div class="inputbox">
				<img src="__PUBLIC__/images/suo.png">
				<input type="password" name="password" id="password" placeholder="请输入密码">
			</div>
<!-- 			<div class="yzmbox">
				<input type="text" id="code_input" value="" placeholder="请输入验证码"/>
				<div id="v_container" style="width: 120px;height: 40px;"></div>
			</div> -->
			<button id="my_button">立即登录</button>
		</div>
		<div class="clearfix"></div>
	</div>

    <!-- jQuery 2.1.4 -->
    <script src="__PUBLIC__/plugins/jQuery/jQuery-2.1.4.min.js" type="text/javascript"></script>
    <!-- Bootstrap 3.3.2 JS -->
    <script src="__PUBLIC__/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="__PUBLIC__/js/gVerify.js"></script>
	<script src="__PUBLIC__/js/layer/layer.js"></script><!-- 弹窗js 参考文档 http://layer.layui.com/-->
    <script>
	     
//	  var verifyCode = new GVerify("v_container");
	
      function checkLogin(){
          var username = $('#username').val();
          var password = $('#password').val();
          var vertify = $('#code_input').val();
          if( username == '' || password ==''){
        	  layer.alert('用户名或密码不能为空', {icon: 2}); //alert('用户名或密码不能为空');
        	  return;
          }
          // if(vertify ==''){
          //  	  layer.alert('验证码不能为空', {icon: 2});
        	 //  return;
          // }
		  // var res = verifyCode.validate(vertify);
    //       if(!res){
    //        	  layer.alert('验证码错误', {icon: 2});
    //        	  //fleshVerify();
    //     	  return; 
    //       }
          
          $.ajax({
  			url:'/index.php?m=Admin&c=Admin&a=login&t='+Math.random(),
			type:'post',
			dataType:'json',
			data:{username:username,password:password},
			success:function(res){
				if(res.status==1){
			     	top.location.href = res.url;
				}else{
					layer.alert(res.msg, {icon: 2});
				}
			}, 
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				layer.alert('网络失败，请刷新页面后重试', {icon: 2});
			}
          })
      }
      
      $("#my_button").click(function() {
	      checkLogin();
	  });
    </script>
  </body>
</html>
